package com.example.demo.alex.service.serviceImpl;

import com.example.demo.alex.mapper.UserMapper;
import com.example.demo.alex.model.User;
import com.example.demo.alex.service.UserService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("userService")
public class UserServiceImpl  implements UserService {
    @Autowired(required = false)
    UserMapper userMapper;


    @Override
    public User getUserbyId(Long id) {
        return userMapper.getUserbyId(id);
    }

    @Override
    public List<User> getUserList(int pageSize,int pageNum) {
        PageHelper.startPage(pageNum,pageSize);
        return userMapper.getUserList();
    }

    @Override
    public int insert(User user) {
        return userMapper.insert(user);
    }
}
